package com.maz.androidprojectcomponenttest.modComponents;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

public class ModifiedTextView extends View {
	private float dx, dy;
	private Paint textPaint;
	
	public ModifiedTextView(Context context) {
		super(context);
		textPaint = new Paint();
		textPaint.setColor(Color.BLACK);
		float textSize = 16 * getResources().getDisplayMetrics().density; 
		textPaint.setTextSize(textSize);
	}
	
	
	

	public ModifiedTextView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		textPaint = new Paint();
		textPaint.setColor(Color.BLACK);
		float textSize = 16 * getResources().getDisplayMetrics().density; 
		textPaint.setTextSize(textSize);
	}




	public ModifiedTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
		textPaint = new Paint();
		textPaint.setColor(Color.BLACK);
		float textSize = 16 * getResources().getDisplayMetrics().density; 
		textPaint.setTextSize(textSize);
	}




	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		String text = "Moving Text";
		canvas.drawText(text, dx, dy, textPaint);
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		dx = event.getX();
		dy = event.getY();
		invalidate();
		return true;
	}
	
	
}
